import random
import string
while 1:
    nums = input("生产激活码的个数：")
    if nums.isdigit():
        break
    else:
        print("输入有误，请重新输入：")
nums2 = int(nums)
pool = string.ascii_uppercase+string.digits

with open("code.txt","w+") as f:
    for i in range(nums2):
        number = "".join(random.choices(pool, k=32))
        f.write(f"{number}\n")

